import Http from './Http'

class UserHttp extends Http{
    static addCart({userId,id}){
        return this.request({
            url:'/api/addCart',
            method:'post',
            data:{
                userId,
                id
            }
        })
    }
    static getCart(userId){
        return this.request({
            url:'/api/getCart',
            params:{
                userId
            }
        })
    }
    static login({username,pwd}){
        return this.request({
            url:'/api/login',
            method:'post',
            data:{
                username,
                pwd
            }
        })
    }
    static logout(){
        return this.request({
            url:'/api/logout',
            method:'post'
        })
    }
    static editCart({id,productNum,checked}){
        return this.request({
            url:'/api/editCart',
            method:'post',
            data:{
                id,
                productNum,
                checked
            }
        })
    }
    static deleteCart(id){
        return this.request({
            url:'/api/deleteCart',
            method:'post',
            data:{
                id
            }
        })
    }
    static setAllChecked(checked){
        return this.request({
            url:'/api/setAllChecked',
            method:'post',
            data:{
                checked
            }
        })
    }
}
export default UserHttp